<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

<div id="app">
	{{num}}
	<button @click="add">点我试试</button>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue@2.7.10/dist/vue.js"></script>
<script>
	const obj = {
    name: '一个对象',
		fun1: function() {
      console.log('fun1的this--->', this);
    },
		fun2: () => {
      console.log('fun2的this--->', this);
    }
	}
  obj.fun1()
  obj.fun2()
	
	
  const app = new Vue({
    el: '#app',
    data: () => {
      console.log(this);
      return {
        num: 0,
      }
    },
    mounted: function () {
      this.add()
    },
    methods: {
      // 不可以使用 `add: () => this.num++`
      // add: () => {
      //   // console.log(this);
      //   this.num++
      // }
      add: function () {
        this.num++
      },
    },
  })
</script>

</body>
</html>
